import { AudioClip, AudioSource, error, _decorator, resources } from 'cc';
const { ccclass, property } = _decorator;

/**
 * 注：用playOneShot播放的音乐效果，在播放期间暂时没办法即时关闭音乐
 */

/** 游戏音效 */
@ccclass('AudioEffect')
export class AudioEffect extends AudioSource {

    private effects: Map<string, AudioClip> = new Map<string, AudioClip>();
    @property (AudioClip)
    shoot :AudioClip = null
    @property (AudioClip)
    bomb: AudioClip = null
    
    playBomb(): void {
        let that = this
        resources.load("bomb", AudioClip,(err,audio)=>{
            that.clip = audio;
            that.play()
        })
    }
    playShoot(): void {
        let that = this
        resources.load("shoot", AudioClip,(err,audio)=>{
            that.clip = audio;
            that.play()
        })
    }
    
}
